<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="最爱古风小雷丘">
    <title></title>
    <style>
       main{
           width: 500px;
           border: 1px solid;
       }
       header{
           width: 100%;;
           height: 30px;
           background-color: black;
           color: white;
           display: flex;
       }
       div{
           width: 80px;
           height: 30px;
           line-height: 30px;
           font-size: 18px;
           display: inline-block;
           text-align: center;
           margin-left: 0;
       }
       ul{
           margin: 0;
           /* padding: 0; */
           font-size: 18px;

       }
       .second,.third{
           display: none;
       }
       .a{
           background-color: lightgrey;
           color: black;
       }
    </style>
</head>
<body>
   <main>
       <header>
           <div class="a">第一节</div>
           <div>第二节</div>
           <div>第三节</div>
       </header>

       <ul class="first">
           <li>这是一段新闻01</li>
           <li>这是一段新闻02</li>
           <li>这是一段新闻03</li>
           <li>这是一段新闻04</li>
           <li>这是一段新闻05</li>
           <li>这是一段新闻06</li>
       </ul>

       <ul class="second">
           <li>这是一句话01</li>
           <li>这是一句话02</li>
           <li>这是一句话03</li>
           <li>这是一句话04</li>
           <li>这是一句话05</li>
           <li>这是一句话06</li>
           <li>这是一句话07</li>
       </ul>

       <ul class="third">
           <li>这是我随便写的01</li>
           <li>这是我随便写的02</li>
           <li>这是我随便写的03</li>
           <li>这是我随便写的04</li>
           <li>这是我随便写的05</li>
           <li>这是我随便写的06</li>
           <li>这是我随便写的07</li>
           <li>这是我随便写的08</li>
           <li>这是我随便写的09</li>
           <li>这是我随便写的10</li>
       </ul>
   </main>
</body>
</html>
<script>
    var divs = document.querySelector('main')
              .querySelectorAll('div');
    var first  = document.querySelector('.first');
    var second  = document.querySelector('.second');
    var third  = document.querySelector('.third');
    var uls = [first,second,third];
    // console.log(uls);
    for(var i = 0;i < divs.length;i++){
        divs[i].index = i ;
        divs[i].onmouseenter = function(){
            for(var i = 0;i<divs.length;i++){
                divs[i].className = '';
                uls[i].style.display = 'none';
            }
           this.className = 'a';
           uls[this.index].style.display = 'block';
           
        }
    }

                          
</script>